package com.xq.method;

/**
 * @author xq
 * @version 1.0
 * @date 2021/4/6 10:01
 * @description 动物猫类
 */
public class Cat extends Animal{

    // 声明动物实体类对象
    private Animal animal;

    public Cat(Animal animal) {
        this.animal = animal;
    }

    @Override
    public void eat() {
        before();
        animal.eat();
        after();
    }

    public void before() {
        System.out.println("在捕捉食物");
    }

    public void after() {
        System.out.println("吃完食物睡一觉");
    }
}
